<?php

namespace humhub\modules\api\controllers;

use humhub\modules\api\models\Tag;
use Yii;
use yii\filters\auth\CompositeAuth;
use yii\filters\auth\HttpBearerAuth;

/**
 * 标签管理
 */
class TagController extends Base4Controller
{



    /**
     * 加入用户权限
     *
     * @inheritdoc
     */
//    public function behaviors(){
//        $behaviors = parent::behaviors();
//        $behaviors['authenticator'] = [
//            'class' => CompositeAuth::className(),
//            'authMethods' => [
//                //QueryParamAuth::className(),
//                HttpBearerAuth::className(),
//            ],
//        ];
//
//        return $behaviors;
//    }
    /**
     * 标签添加
     *
     * GET api/tag/add
     *
     * get.tag  标签名称
     *
     *@return boolean true 添加成功
     */
    public function actionAdd()
    {
        $tag=new Tag();
        $name=Yii::$app->request->get('tag');
        $tag->name=$name;

        return $tag->save();

    }
}

